package com.cloudkinto.common.utils.dict;

import com.cloudkinto.common.utils.StringsUtil;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;

public class StaticDict {



    @Getter
    public enum STOCK_ADJUST_TYPE {
        ADJUST("adjust", "库存调整"),
        ORDER_OUT("ot", "一件代发"),
        ORDER_BACK("ob", "退货订单"),
        FBA_OUT("fot", "FBA订单"),
        TRANSFER("transfer", "库内调货"),
        REPAIR("repair", "维修"),
        ORDER_INPUT("input", "入库"),
        Replacement("replacement", "补发配件");

        private String value;
        private String text;


        STOCK_ADJUST_TYPE(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (STOCK_ADJUST_TYPE type : STOCK_ADJUST_TYPE.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }


    @Getter
    public enum Mail_Type {
        QQ("@qq.com", "smtp.qq.com", "imap.qq.com", "QQ邮箱", "icon-QQyouxiang"),
        NetEase("@163.com", "smtp.163.com", "imap.163.com", "网易云邮箱", "icon-num163"),
        Ease126("@126.com", "smtp.126.com", "imap.126.com", "126网易免费邮", "icon-youxiang1"),
        Sina("@sina.com", "smtp.sina.com", "smtp.sina.com", "新浪邮箱", "icon-xinlangyouxiang"),
        Outlook("@outlook.com", "smtp.office365.com", "outlook.office365.com", "outlook邮箱", "icon-Outlook"),
        Gmail("@gmail.com", "smtp.gmail.com", "imap.gmail.com", "谷歌邮箱", "icon-guge");

        private String value;
        private String smtp;
        private String imap;
        private String text;
        private String icon;

        Mail_Type(String value, String smtp, String imap, String text, String icon) {
            this.value = value;
            this.smtp = smtp;
            this.imap = imap;
            this.text = text;
            this.icon = icon;
        }

        public static String getSmtp(String value) {
            if (value == null) {
                return "";
            }
            for (Mail_Type type : Mail_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getSmtp();
                }
            }
            return "";
        }

        public static String getImap(String value) {
            if (value == null) {
                return "";
            }
            for (Mail_Type type : Mail_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getImap();
                }
            }
            return "";
        }

        public static String getIcon(String smtp) {
            if (smtp == null) {
                return "";
            }
            for (Mail_Type type : Mail_Type.values()) {
                if (smtp.equals(type.getSmtp())) {
                    return type.getIcon();
                }
            }
            return "";
        }
    }


    @Getter
    public enum Mail_Folder_Type {
        Other("其他文件夹", "其他文件夹", "", "其他邮件", "", "[Gmail]"),
        INBOX("INBOX", "收件箱", "INBOX", "INBOX", "Inbox", "INBOX"),
        OUTBOX("Sent Messages", "发件箱", "已发送", "已发送", "Sent", "已发邮件"),
        DRAFTS("Drafts", "草稿箱", "草稿箱", "草稿夹", "Drafts", "草稿"),
        DELETED("deleted", "已删除", "已删除", "已删除", "Deleted", "已删除邮件"),
        JUNK("Junk", "垃圾箱", "垃圾邮件", "垃圾邮件", "Junk", "垃圾邮件");
        private String value;
        private String text;
        private String ease;
        private String sina;
        private String outlook;
        private String gmail;

        Mail_Folder_Type(String value, String text, String ease, String sina, String outlook, String gmail) {
            this.value = value;
            this.text = text;
            this.ease = ease;
            this.sina = sina;
            this.outlook = outlook;
            this.gmail = gmail;
        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Mail_Folder_Type type : Mail_Folder_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }

        public static String getValueByEase(String ease) {
            if (ease == null) {
                return "";
            }
            for (Mail_Folder_Type type : Mail_Folder_Type.values()) {
                if (ease.equals(type.getEase())) {
                    return type.getValue();
                }
            }
            return "";
        }

        public static String getValueBySina(String sina) {
            if (sina == null) {
                return "";
            }
            for (Mail_Folder_Type type : Mail_Folder_Type.values()) {
                if (sina.equals(type.getSina())) {
                    return type.getValue();
                }
            }
            return "";
        }

        public static String getValueByOutlook(String outlook) {
            if (outlook == null) {
                return "";
            }
            for (Mail_Folder_Type type : Mail_Folder_Type.values()) {
                if (outlook.equals(type.getOutlook())) {
                    return type.getValue();
                }
            }
            return "";
        }

        public static String getValueByGmail(String gmail) {
            if (gmail == null) {
                return "";
            }
            for (Mail_Folder_Type type : Mail_Folder_Type.values()) {
                if (gmail.equals(type.getGmail())) {
                    return type.getValue();
                }
            }
            return "";
        }
    }


    /**
     * 附件 一对多 类型
     */

    @Getter
    public enum File_Type {
        NewProduct("newProduct", "新品开发图片"),
        ReceiveNote("receiveNote", "收货单附件"),
        QualityCheckPic("qualityCheckPic", "质检单图片"),
        QualityCheckFile("qualityCheckFile", "质检单附件"),
        Rakuten("rakuten", "乐天邮件附件"),
        Mail("mail", "邮件"),
        Oversea("oversea", "海外仓备货单附件"),
        RepairAttach("repairAttach", "维修管理附件"),
        RepairPic("repairPic", "维修管理维修照片");
        private String value;
        private String text;


        File_Type(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (File_Type type : File_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    @Getter
    public enum Rule_Type {
        Finance(6L, "财务");
        private Long value;
        private String text;


        Rule_Type(Long value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(Long value) {
            if (value == null) {
                return "";
            }
            for (Rule_Type type : Rule_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    @Getter
    public enum Pick_Up_Status {
        ToPick(0, "未拣货"),
        UnPick(1, "待拣货"),
        Picked(2, "已拣货");

        private Integer value;
        private String text;


        Pick_Up_Status(Integer value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(Integer value) {
            if (value == null) {
                return "";
            }
            for (Pick_Up_Status type : Pick_Up_Status.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }


    @Getter
    public enum Track_Type {
        SagawaExpress(8L, "佐川急便", true),
        YamatoExpress(9L, "ヤマト運輸", true),
        JpostExpress(10L, "日本郵便A", true),
        XinongExpress(42L, "西浓运输", true),
        // JpostExpressCom(44L, "日本郵便B"),
        // JpostExpressCod(79L, "日本郵便COD"),
        // YamatoExpressBox(179L, "ヤマト運輸(box)"),
        YamatoExpressCod(180L, "ヤマト運輸COD", false),
        fbaTrackNameZiti(162L, "亚马逊自提", false),
        YamatoExpressJCB(188L, "黑猫家财便", true),
        YamatoExpressBig(190L, "ヤマト運輸100以上",true);

        private Long value;
        private String text;
        private Boolean useFlag;

        Track_Type(Long value, String text, boolean useFlag) {
            this.value = value;
            this.text = text;
            this.useFlag = useFlag;
        }

        public static String getText(Long value) {
            if (value == null) {
                return "";
            }
            for (Track_Type type : Track_Type.values()) {
                if (value.equals(type.getValue())) {
                    return StringsUtil.createI18Message(type.getText());
                }
            }
            return "";
        }


        public static Boolean isUseFlag(Long value) {
            if (value == null) {
                return null;
            }
            for (Track_Type type : Track_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.useFlag;
                }
            }
            return null;
        }
    }


    @Getter
    public enum Order_Repair_Status_Type {
        ToCheck("toCheck", "待确认"),
        Checked("checked", "已确认"),
        Repairing("repairing", "维修中"),
        Repaired("repaired", "维修完成"),
        //Paid("paid", "已收费"),
        Finish("finish", "订单完成"),
        Discard("discard", "废弃");

        private String value;
        private String text;


        Order_Repair_Status_Type(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Order_Repair_Status_Type type : Order_Repair_Status_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    @Getter
    public enum Order_Repair_Operate_Type {
        OrderRepair_Delete_RepairPic("OrderRepair_Delete_RepairPic", "删除维修附件: %1$s"),
        OrderRepair_Delete_Attach("OrderRepair_Delete_Attach", "删除附件: %1$s"),
        OrderRepair_Upload_RepairPic("OrderRepair_Upload_RepairPic", "上传维修附件: %1$s"),
        OrderRepair_Upload_Attach("OrderRepair_Upload_Attach", "上传附件: %1$s"),
        OrderRepair_DeleteComponent("OrderRepair_DeleteComponent", "删除部件: %1$s"),
        OrderRepair_DeleteSku("OrderRepair_DeleteSku", "删除Sku: %1$s"),
        OrderRepair_Update("OrderRepair_Update", "更新维修订单"),
        OrderRepair_Create("OrderRepair_Create", "创建维修订单"),
        OrderRepair_MarkConfirm("OrderRepair_MarkConfirm", "标记已确认"),
        OrderRepair_BeginRepair("OrderRepair_BeginRepair", "开始维修"),
        OrderRepair_PartRepair("OrderRepair_PartRepair", "部分维修完成"),
        OrderRepair_FinishRepair("OrderRepair_FinishRepair", "维修完成"),
        OrderRepair_CannotRepair("OrderRepair_CannotRepair", "无法维修"),
        OrderRepair_CusIndicate_Grounding("OrderRepair_CusIndicate_Grounding", "客户指示上架"),
        OrderRepair_CusIndicate_Discard("OrderRepair_CusIndicate_Discard", "客户指示上架"),
        OrderRepair_FinishIndicate_Grounding("OrderRepair_FinishIndicate_Grounding", "完成指示上架"),
        OrderRepair_FinishIndicate_Discard("OrderRepair_FinishIndicate_Discard", "完成指示废弃"),
        OrderRepair_Charge("OrderRepair_Charge", "收费");
        private String value;
        private String text;


        Order_Repair_Operate_Type(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Order_Repair_Operate_Type type : Order_Repair_Operate_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    @Getter
    public enum Product_Info_Type {
        Common("common", "普通产品"),
        Combination("combination", "组合产品"),
        Material("material", "耗材");
        private String value;
        private String text;


        Product_Info_Type(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Product_Info_Type type : Product_Info_Type.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    @Getter
    public enum Menu_Button {
        StockTransfer_Examine("StockTransfer:examine", "库内调货-审核");
        private String value;
        private String text;


        Menu_Button(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Menu_Button type : Menu_Button.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }


    @Getter
    public enum Product_Type {
        Three(3L, "日用百货"),
        Four(4L, "箱包服饰"),
        Five(5L, "家居家具"),
        Common_Material(169L, "普通耗材");

        private Long value;
        private String text;


        Product_Type(Long value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(Long value) {
            if (value == null) {
                return "";
            }
            for (Product_Type type : Product_Type.values()) {
                if (value.equals(type.getValue())) {
                    return StringsUtil.createI18Message(type.getText());
                }
            }
            return "";
        }
    }


    @Getter
    public enum Order_Back_Track_Type {
        SagawaExpress(8L, "佐川急便"),
        YamatoExpress(9L, "ヤマト運輸"),
        JpostExpress(10L, "日本郵便"),
        XinongExpress(42L, "西浓运输"),
        Other(-1L, "其他");


        private Long value;
        private String text;


        Order_Back_Track_Type(Long value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(Long value) {
            if (value == null) {
                return "";
            }
            for (Order_Back_Track_Type type : Order_Back_Track_Type.values()) {
                if (value.equals(type.getValue())) {
                    return StringsUtil.createI18Message(type.getText());
                }
            }
            return "";
        }

        public static Long getValueByText(String text) {
            if (StringUtils.isBlank(text)) {
                return null;
            }
            for (Order_Back_Track_Type type : Order_Back_Track_Type.values()) {
                if (text.equals(type.getText())) {
                    return type.getValue();
                }
            }
            return null;
        }
    }


    @Getter
    public enum Order_Door_Pick_Status {
        ToCheck("toCheck", "待审核"),
        ToRegister("toRegister", "已审核"),
        //        ToPick("toPick", "待取件"),
        Picked("picked", "预约成功"),
        Finish("finish", "取件成功"),
        Cutting("cutting", "截单中"),
        CutOff("cutOff", "截单完成"),
        Problem("problem", "问题件");

        private String value;
        private String text;


        Order_Door_Pick_Status(String value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(String value) {
            if (value == null) {
                return "";
            }
            for (Order_Door_Pick_Status type : Order_Door_Pick_Status.values()) {
                if (value.equals(type.getValue())) {
                    return type.getText();
                }
            }
            return "";
        }
    }

    //
    // @Getter
    // public enum Product_Flowing_Type {
    //     OrderRepair("orderRepair", "维修订单部件"),
    //     ReleaseLock("releaseLock", "一件代发释放锁定库存"),
    //     CutOff("cutOff", "截单"),
    //     DistributeStore("distributeStore", "配货区调货"),
    //     DistributeStock("distributeStock", "分配库存"),
    //     RackUpdate("rackUpdate", "更新库存"),
    //     Back("back", "退货单"),
    //     Output("output", "出库单"),
    //     Input("input", "入库单"),
    //     InputRoll("inputRoll", "入库单回滚"),
    //     FbaOutput("fbaOutput", "fba发货记录"),
    //     FbaOutputRoll("fbaOutputRoll", "fba回滚记录"),
    //     OutputRoll("outputRoll", "一件代发回滚记录"),
    //     FbaSend("fbaSend", "fba发货记录");
    //     private String value;
    //     private String text;
    //
    //
    //     Product_Flowing_Type(String value, String text) {
    //         this.value = value;
    //         this.text = text;
    //
    //     }
    //
    //     public static String getText(String value) {
    //         if (value == null) {
    //             return "";
    //         }
    //         for (Product_Flowing_Type type : Product_Flowing_Type.values()) {
    //             if (value.equals(type.getValue())) {
    //                 return type.getText();
    //             }
    //         }
    //         return "";
    //     }
    // }
    //
    // @Getter
    // public enum STOCK_ADJUST_TYPE {
    //     ADJUST("adjust", "库存调整"),
    //     ORDER_OUT("ot", "一件代发"),
    //     ORDER_BACK("ob", "退货订单"),
    //     FBA_OUT("fot", "FBA订单"),
    //     TRANSFER("transfer", "库内调货"),
    //     REPAIR("repair", "维修"),
    //     ORDER_INPUT("input", "入库");
    //     private String value;
    //     private String text;
    //
    //
    //     STOCK_ADJUST_TYPE(String value, String text) {
    //         this.value = value;
    //         this.text = text;
    //
    //     }
    //
    //     public static String getText(String value) {
    //         if (value == null) {
    //             return "";
    //         }
    //         for (STOCK_ADJUST_TYPE type : STOCK_ADJUST_TYPE.values()) {
    //             if (value.equals(type.getValue())) {
    //                 return type.getText();
    //             }
    //         }
    //         return "";
    //     }
    // }

    @Getter
    public enum Temu_Track_Type {
        SagawaExpress(8L, "sagawa"),
        YamatoExpress(9L, "yamato"),
        YamatoSExpress(163L, "yamatos"),
        JpostExpress(10L, "jpost"),
        XinongExpress(42L, "seino");


        private Long value;
        private String text;


        Temu_Track_Type(Long value, String text) {
            this.value = value;
            this.text = text;

        }

        public static String getText(Long value) {
            if (value == null) {
                return "";
            }
            for (StaticDict.Temu_Track_Type type : StaticDict.Temu_Track_Type.values()) {
                if (value.equals(type.getValue())) {
                    return StringsUtil.createI18Message(type.getText());
                }
            }
            return "";
        }

        public static Long getValue(String text) {
            if (text == null) {
                return 0l;
            }
            for (StaticDict.Temu_Track_Type type : StaticDict.Temu_Track_Type.values()) {
                if (text.equals(type.getText())) {
                    return type.getValue();
                }
            }
            return 0L;
        }
    }
}
